/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sunrise.bean;

import com.sunrise.boundary.UserManager;
import com.sunrise.entity.User;
import java.net.URI;
import java.net.URISyntaxException;
import javax.ejb.EJB;
import javax.ejb.EJBException;
import javax.inject.Named;
import javax.enterprise.context.RequestScoped;

/**
 *
 * @author frank
 */
@Named(value = "registrationBean")
@RequestScoped
public class RegistrationBean {
    
    @EJB
    private UserManager userManager;
    
    private User user;
    
    public RegistrationBean() {
    }
    
    public User getUser() {
        if (user==null) {
            user = new User();
        }
        return user;
    }
    
    public void setUser(User user) {
        this.user = user;
    }
    
    public String register() {
        userManager.save(user);
        return "core/calendar?faces-redirect=true";
    }
}
